package com.haoran.dwz.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.haoran.dwz.rest.R;
import com.haoran.dwz.service.RoleService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = { "Roles" }, description = "角色管理",position=12)
@RestController
@RequestMapping(value = "/roles", headers = "Authorization",produces = "application/json;charset=UTF-8")
public class RoleController {
	@Autowired
	private RoleService roleService;
	
	@ApiOperation("查询所有角色列表")
	@RequestMapping(method = RequestMethod.GET)
	public R list() {
		try {
			return R.success(roleService.findAll());
		} catch (Exception e) {
			return R.failure(e);
		}
	}
}
